{extend name="template/base" /}
{block name="nav"}{/block}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <input type="hidden" name="sms_stores_id" value="{$vo.sms_stores_id ?? $sms_stores_id}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>商品名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$vo.name ?? ''}" placeholder="" name="name" datatype="*" nullmsg="请填写电话">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>商品分类：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <span class="select-box">
                  <select class="select" name="sms_store_types_id">
                      {volist name="storeTypes" id="st"}
                      <option value="{$st.id}" {$st.id==@$vo.sms_store_types_id?'selected':''}>{$st.name}</option>
                      {/volist}
                  </select>
                </span>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>价格：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text" value="{$vo.price ?? ''}" step="0.01" name="price" datatype="*" nullmsg="请填写商品价格">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">原始价格：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text" value="{$vo.old_price ?? ''}"  step="0.01"  name="old_price" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>单位：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" value="{$vo.unit ?? ''}" name="unit" datatype="*" placeholder="如：个"   nullmsg="请填写单位">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>数量（库存）：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="number" class="input-text" value="{$vo.total ?? ''}" name="total" datatype="*" nullmsg="请填写商品库存数量">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>缩略图：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" readonly class="input-text" name="thumb" value="{$vo.thumb ?? ''}" id="upload" placeholder="请点击后面的上传按钮" datatype="*" nullmsg="请填写图片url" style="width: 70%">
                <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','{:\\think\\Url::build(\'Upload/index\', [\'id\' => \'upload\'])}')">上传</button>
                <a onclick="$(this).attr('href', 'http://{$Request.host}/public'+$('#upload').val())" type="button" href="" class="btn btn-success radius" data-lightbox="example-1">预览</a>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">简短说明：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="intro" value="{$vo.intro ?? '随买随到'}" placeholder="随买随到" datatype="*">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">运费：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="fare_info" value="{$vo.fare_info ?? '商家承担运费'}" placeholder="商家承担运费" datatype="*">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">服务：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="serve_info" value="{$vo.serve_info ?? '30分钟发货，急速退款'}" placeholder="30分钟发货，急速退款" datatype="*">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--<div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">规格：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" name="rule_info" value="{$vo.rule_info ?? '规格选择'}" placeholder="规格选择" datatype="*">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>-->

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>详情：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <script id="editor" name="details" type="text/plain" style="height:400px">{if condition="isset($vo.details)"}{$vo.details|htmlspecialchars_decode=###}{/if}</script>
            </div>
            <div class="formControls col-xs-6 col-sm-6">
                <div id="markdown" class="mt-20"></div>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="status" id="status-1" value="1" datatype="*" nullmsg="请选择状态">
                    <label for="status-1">启用</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="status" id="status-0" value="0">
                    <label for="status-0">禁用</label>
                </div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--<div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="textarea" placeholder="" name="remark" onKeyUp="textarealength(this,100)">{$vo.remark ?? ''}</textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>-->

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>
    $(function () {
        $("[name='status'][value='{$vo.status ?? '1'}']").attr("checked",true);

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                ajax_progress(ret);
            }
        });
    })
    function selectType(fid,sid,tid,str) {
        $('#sel-types').val(str);
        $('input[name=types_first_id]').val(fid);
        $('input[name=types_second_id]').val(sid);
        $('input[name=types_third_id]').val(tid);
    }
</script>


<script type="text/javascript" src="__LIB__/showdown/1.4.2/showdown.min.js"></script>
<script>window.UEDITOR_HOME_URL = '__LIB__/ueditor/1.4.3/'</script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script>

    $(function () {
        var ue = UE.getEditor('editor',{
            serverUrl:'{:\\think\\Url::build("Ueditor/index")}'
        });
        var converter = new showdown.Converter(),
            text      = $("#markdown_tpl").html();
        $("#markdown").html(converter.makeHtml(text));
    })
</script>
{literal}
<script type="text/plain" id="markdown_tpl">
</script>
{/literal}
<link rel="stylesheet" type="text/css" media="screen" href="__LIB__/lightbox2/css/lightbox.css" />
<script type="text/javascript" src="__LIB__/lightbox2/js/lightbox.js"></script>
{/block}